package com.foreknow.elm.service.impl;

import com.foreknow.elm.dao.impl.OrderdetailetDaoImpl;
import com.foreknow.elm.po.Orderdetailet;
import com.foreknow.elm.service.OrderdetailetService;
import com.foreknow.elm.util.DBUtil;

import java.util.ArrayList;
import java.util.List;

public class OrderdetailetServiceImpl implements OrderdetailetService {
    @Override
    public int save(List<Orderdetailet> orderdetailet) {
        int result = 0;
        OrderdetailetDaoImpl orderdetailetDao = new OrderdetailetDaoImpl();
        try {
            DBUtil.beginTransaction();
            result= orderdetailetDao.save(orderdetailet);
            DBUtil.commitTransaction();
        } catch (Exception e) {
            e.printStackTrace();
            try {
                DBUtil.rollbackTransaction();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }finally {
            DBUtil.close();
        }
        return result;
    }
}
